package Vista;


//import java.awt.event.MouseAdapter;
//import java.awt.event.MouseEvent;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import java.awt.event.ActionListener;



/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class JFrameCliente extends javax.swing.JFrame {
	private JPanel jPanelCliente;
	private JButton jBtnLimpiar;
	private JButton jBtnSalir;
	private JButton jBtnEliminar;
	private JButton jBtnModificar;
	private JTextField jTelefono;
	private JButton jBtnRegistrar;
	private JButton jBtnBuscar;
	private JTextField jDireccion;
	private JTextField jApeCliente;
	private JTextField jNombCliente;
	private JLabel jLblTlfCliente;
	private JLabel jLblDireccion;
	private JLabel jLblApeCliente;
	private JLabel jLblNombCliente;
	private JTextField jCodCliente;
	private JLabel jLblCodCliente;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrameCliente inst = new JFrameCliente();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public JFrameCliente() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("SGECR [Modulo de Archivos] - Gestión de Clientes");
			getContentPane().setBackground(new java.awt.Color(93,193,225));
			this.setIconImage(new ImageIcon(getClass().getClassLoader().getResource("search.ico")).getImage());
			{
				jPanelCliente = new JPanel();
				GroupLayout jPanelClienteLayout = new GroupLayout((JComponent)jPanelCliente);
				jPanelCliente.setLayout(jPanelClienteLayout);
				jPanelCliente.setBackground(new java.awt.Color(173,216,230));
				{
					jLblCodCliente = new JLabel();
					jLblCodCliente.setText("Cod. Cliente");
				}
				{
					jBtnBuscar = new JButton();
					jBtnBuscar.setText("Buscar");
				}
				{
					jBtnRegistrar = new JButton();
					jBtnRegistrar.setText("Registrar");
					
				}
				{
					jBtnModificar = new JButton();
					jBtnModificar.setText("Modificar");
				}
				{
					jBtnEliminar = new JButton();
					jBtnEliminar.setText("Eliminar");
				}
				{
					jBtnSalir = new JButton();
					jBtnSalir.setText("Salir");
					jBtnSalir.setBackground(new java.awt.Color(229,229,229));
				}
				{
					jBtnLimpiar = new JButton();
					jBtnLimpiar.setText("Limpiar");
				}
				{
					jDireccion = new JTextField();
				}
				{
					jTelefono = new JTextField();
				}
				{
					jCodCliente = new JTextField();
				}
				{
					jLblNombCliente = new JLabel();
					jLblNombCliente.setText("Nombre:");
				}
				{
					jLblApeCliente = new JLabel();
					jLblApeCliente.setText("Apellido:");
				}
				{
					jLblDireccion = new JLabel();
					jLblDireccion.setText("Direccion:");
				}
				{
					jLblTlfCliente = new JLabel();
					jLblTlfCliente.setText("Telefono:");
				}
				{
					jNombCliente = new JTextField();
				}
				{
					jApeCliente = new JTextField();
				}
					jPanelClienteLayout.setHorizontalGroup(jPanelClienteLayout.createSequentialGroup()
					.addContainerGap(35, 35)
					.addGroup(jPanelClienteLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jLblNombCliente, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE)
					        .addGap(20))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jLblApeCliente, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE)
					        .addGap(20))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jLblDireccion, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE)
					        .addGap(20))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jLblTlfCliente, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE)
					        .addGap(20))
					    .addComponent(jLblCodCliente, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(jPanelClienteLayout.createParallelGroup()
					    .addComponent(jApeCliente, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jNombCliente, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jCodCliente, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jDireccion, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jTelefono, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE))
					.addGap(38)
					.addGroup(jPanelClienteLayout.createParallelGroup()
					    .addGroup(jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jBtnLimpiar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jBtnSalir, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jBtnEliminar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jBtnModificar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jBtnRegistrar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jBtnBuscar, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 18, Short.MAX_VALUE)))
					.addContainerGap(55, 55));
					jPanelClienteLayout.setVerticalGroup(jPanelClienteLayout.createSequentialGroup()
					.addContainerGap(17, 17)
					.addGroup(jPanelClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jBtnBuscar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jCodCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblCodCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(jPanelClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jBtnRegistrar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jNombCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblNombCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(jPanelClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jBtnModificar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jApeCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblApeCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(jPanelClienteLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					        .addComponent(jDireccion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
					        .addComponent(jBtnEliminar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelClienteLayout.createSequentialGroup()
					        .addComponent(jLblDireccion, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					        .addGap(21)))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(jPanelClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jBtnLimpiar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jTelefono, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblTlfCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addComponent(jBtnSalir, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(30, Short.MAX_VALUE));
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(38, 38)
				.addComponent(jPanelCliente, GroupLayout.PREFERRED_SIZE, 248, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(33, Short.MAX_VALUE));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(53, 53)
				.addComponent(jPanelCliente, GroupLayout.PREFERRED_SIZE, 431, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(52, Short.MAX_VALUE));
			pack();
			this.setSize(546, 349);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	public void addListener(ActionListener actionlistener)
	{
		jBtnBuscar.addActionListener(actionlistener);
		jBtnRegistrar.addActionListener(actionlistener);
		jBtnModificar.addActionListener(actionlistener);
		jBtnEliminar.addActionListener(actionlistener);
		jBtnLimpiar.addActionListener(actionlistener);
		jBtnSalir.addActionListener(actionlistener);
	}
	
	public void MostrarMensaje(String mensaje)
	{
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public String getCodCliente()
	{
	 return jCodCliente.getText();
	 
	}
	public String getNombCliente()
	{
	 return jNombCliente.getText();
	 
	}
	public String getApeCliente()
	{
	 return jApeCliente.getText();
	}
	public String getDireccion()
	{
	 return jDireccion.getText();
	}
	public String getTelefono()
	{
	 return jTelefono.getText();
	 
	}
	public void setCodCliente(String cod)
	{
		jCodCliente.setText(cod);
	}
	public void setNombCliente(String nom)
	{
		jNombCliente.setText(nom);
	}
	public void setApeCliente(String ape)
	{
		jApeCliente.setText(ape);
	}
	public void setDireccion(String dir)
	{
		jDireccion.setText(dir);
	}
	public void setTelefono(String tlf)
	{
		jTelefono.setText(tlf);
	}
	
	public void Blanquear()
	{
		jCodCliente.setText("");
		jNombCliente.setText("");
		jApeCliente.setText("");
		jDireccion.setText("");
		jTelefono.setText("");
	}
	
	public void Habilitar(boolean r) {
		// TODO Auto-generated method stub
		if(r=true)
		{
		jCodCliente.setEditable(false);
		jNombCliente.setEditable(true);
		jApeCliente.setEditable(true);
		jDireccion.setEditable(true);
		jTelefono.setEditable(true);
		}
		else jCodCliente.setEditable(true);
	}
}
